import Vue from 'vue'
import VueRouter from "vue-router"
Vue.use(VueRouter);

// 引入路由组件
import Layout from "@/views/Layout"
import Home from "@/views/Home"
import Search from "@/views/Search"
import Play from "@/views/Play"
import Comment from "@/views/Comment"

const router = new VueRouter({
    routes: [
      {
        path: '/',
        // 重定向
        redirect:'/layout',
      },
      {
        path:'/layout',
        redirect:'/layout/home',// 马上重定向到二级路由home
        component:Layout,
        children:[
          {
            path:'home',
            component:Home,
            meta:{
              title:'首页'
            }
          },
          {
            path:'search',
            component:Search,
            meta:{
              title:'搜索'
            }
          }
        ]
      },
      {
        path:'/play',
        component:Play
      },
      {
        path:'/comment',
        component:Comment
      }
    ]
})

export default router;
